package cool.qingqing.error;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cool.qingqing.result.Result;

@RestController
public class Error {
    @RequestMapping("/error")
    public Result error(HttpServletRequest request,HttpServletResponse response) throws IOException{
        // 返回403错误
            response.setStatus(HttpStatus.FORBIDDEN.value());
            // 返回类型,json格式
            response.setContentType(MediaType.APPLICATION_JSON_VALUE);
            // 返回值编码 ，utf-8,不设置可能出现乱码
            response.setCharacterEncoding("utf-8");
            response.getWriter().write("错误描述");


        return null;
    }
    
}
